//
//  HJInformationAuthorView.m
//  KaiChat
//
//  Created by lx on 2024/3/11.
//

#import "HJInformationAuthorView.h"

@implementation HJInformationAuthorView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        UIImageView *avatarImageView = [UIImageView addToView:self];
        avatarImageView.addCornerRadius(20);
        avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
        [avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(leftRightMargin);
            make.centerY.offset(0);
            make.width.height.offset(40);
        }];
        
        UILabel *nameLabel = [UILabel lableWithSuperView:self font:UIFontMediumMake(16) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
        [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(avatarImageView.mas_right).offset(10);
            make.top.equalTo(avatarImageView).offset(2);
            make.right.mas_lessThanOrEqualTo(-86);
        }];
     
        UILabel *dateLabel = [UILabel lableWithSuperView:self font:UIFontMake(12) color:UIColor.tj_BEBDCAColor title:nil textAlignment:NSTextAlignmentLeft];
        [dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(nameLabel);
            make.bottom.equalTo(avatarImageView).inset(2);
        }];
        
        UIButton *moreButton = [UIButton buttonWithSuperView:self font:UIFontMake(14) color:UIColor.tj_mainColor title:nil];
        [moreButton setImage:[UIImage imageNamed:@"informationOperate_more"] forState:UIControlStateNormal];
        [moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.offset(40);
            make.right.inset(9);
            make.centerY.offset(0);
        }];
        
        _avatarImageView = avatarImageView;
        _nameLabel = nameLabel;
        _dateLabel = dateLabel;
        _moreButton = moreButton;
        
    }
    return self;
}

@end
